package scjp.preparation.exam;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TestRegex {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		String quote = "aba*abaa**aabaa***";
		String [] words = quote.split("a\\**", 10);
		System.out.println(words);
		for (String word : words) {
		System.out.println(word);
		}
		
//		String str1 = "xxzz";
//		String str2 = "xyz";
//		String str3 = "yzz";
//		Pattern pattern = Pattern.compile("(xx)*y?z{1,}");
//		Matcher matcher = pattern.matcher(str1);
//		System.out.println(matcher.matches());
//		System.out.println(pattern.matcher(str2).matches());
//		System.out.println(
//		Pattern.compile("(xx)*y?z{1,}").
//		matcher(str3).matches());
		
//		String str = "OCPJP 2013 OCPJP7";
//		Pattern pattern = Pattern.compile("\\b\\w+\\D\\b");
//		Matcher matcher = pattern.matcher(str);
//		while(matcher.find()) {
//		System.out.println(matcher.group());
//		}
		
		String str =
				"Suneetha N.=9876543210, Pratish Patil=9898989898";
				Pattern pattern =
				Pattern.compile("(\\w+)(\\s\\w+)(=)(\\d{10})");
				Matcher matcher = pattern.matcher(str);
				String newStr = matcher.replaceAll("$4:$2,$1");
				System.out.println(newStr);

	}

}
